| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | List of all members
nkGraphics::Renderer Class Referenceabstract

A renderer, implementing the logic of using a graphics API. More...

## Public Member Functions
| Renderer () noexcept
virtual | ~Renderer ()
virtual DataAllocator * | getAllocator () const =0
virtual RendererSupportInfo | getRendererSupportInfo () const =0
virtual nkMemory::UniquePtr< nkExport::Node > | getStats () const =0
virtual RendererAbstractData | getInternalData () const
RENDERING_API | getRenderApi () const
virtual bool | initialize (const Configuration &config)=0
virtual bool | initiateBuiltInShaders ()=0
virtual bool | postGraphicSystemInit ()=0
virtual void | prepareForRelease ()=0
virtual bool | shutdown ()=0
virtual void | flushRendering ()=0
virtual void | preRenderRoutine ()=0
virtual void | postRenderRoutine ()=0

## Detailed Description

A renderer, implementing the logic of using a graphics API.

There is one per supported graphics API, and it is chosen at startup based on the configuration provided and the capabilities of the machine. In theory, external code should only use this class to :

- Flush the rendering pipeline (and ensure nothing is left working on the GPU)
- Retrieve internal statistics about the rendering
- Retrieve compatibility reports about various features GPU can or cannot support

## Constructor & Destructor Documentation

## ◆ Renderer()

nkGraphics::Renderer::Renderer | ( |  | ) |
| noexcept

Constructor.

## ◆ ~Renderer()

virtual nkGraphics::Renderer::~Renderer | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ getAllocator()

virtual DataAllocator* nkGraphics::Renderer::getAllocator | ( |  | ) | const
| pure virtual

Returns
  The data allocator for the renderer. Drives all the allocations for renderer dependent resources.

Remarks
  In theory, this function should not be called by external code. To allocate a resource, call the corresponding Manager.

## ◆ getRendererSupportInfo()

virtual RendererSupportInfo nkGraphics::Renderer::getRendererSupportInfo | ( |  | ) | const
| pure virtual

Returns
  The supported features for the renderer and hardware.

## ◆ getStats()

virtual nkMemory::UniquePtr<nkExport::Node> nkGraphics::Renderer::getStats | ( |  | ) | const
| pure virtual

Returns
  Statistics about the renderer, such as memory consumption.

Remarks
  The statistics returned depend on which renderer type is being used, as each renderer works differently internally. As such, a data tree is returned, featuring members describing the stats the renderer wishes to expose. If necessary, a human readable version can be generated using nkExport's Json capabilities.

## ◆ getInternalData()

virtual RendererAbstractData nkGraphics::Renderer::getInternalData | ( |  | ) | const
| virtual

Allows to retrieve internal data proper to each renderer type. This data can allow a client application to hook deep into the renderer, but must be done with care as the renderer won't be aware of the potential injection.
Per renderer, what can be expected :

Key | Underlying type | Syntax | Description |
--- | --- | --- | --- | ---
Dx11Renderer
DEVICE | ID3D11Device | (ID3D11Device*)d.get("DEVICE") ; | The device interface used by the renderer.
CONTEXT | ID3D11DeviceContext | (ID3D11DeviceContext*)d.get("CONTEXT") ; | The device context interface used by the renderer.
Dx12Renderer
DEVICE | ID3D12Device | (ID3D12Device*)d.get("DEVICE") ; | The device interface used by the renderer.
DIRECT_COMMAND_QUEUE | ID3D12CommandQueue | (ID3D12CommandQueue*)d.get("DIRECT_COMMAND_QUEUE") ; | The direct command queue used by the renderer.
RESOURCE_COMMAND_QUEUE | ID3D12CommandQueue | (ID3D12CommandQueue*)d.get("RESOURCE_COMMAND_QUEUE") ; | The resource command queue used by the renderer.
GlesRenderer
BASE_HDC | HDC | (HDC)d.get("HDC") ; | The base HDC used by the renderer. Note that this uses the base window created by the renderer, not a client application's one.
CONTEXT | HGLRC | (HGLRC)d.get("CONTEXT") ; | The HGLRC context used by the renderer.

Returns
  A dictionary of values proper to each renderer type.

## ◆ getRenderApi()

RENDERING_API nkGraphics::Renderer::getRenderApi | ( |  | ) | const

Returns
  The rendering API associated to the renderer.

## ◆ initialize()

virtual bool nkGraphics::Renderer::initialize | ( | const Configuration & | config | ) |
| pure virtual

Initializes the renderer given a configuration. This is taken care of by the component initialization process and should not be called by external code.

Parameters

  config | The configuration to use to initialize the renderer.

Returns
  If the initalization went well.

## ◆ initiateBuiltInShaders()

virtual bool nkGraphics::Renderer::initiateBuiltInShaders | ( |  | ) |
| pure virtual

Initializes the built in shaders. This is taken care of by the component initialization process and should not be called by external code.

Returns
  If the initalization went well.

## ◆ postGraphicSystemInit()

virtual bool nkGraphics::Renderer::postGraphicSystemInit | ( |  | ) |
| pure virtual

Post initialization step. This is taken care of by the component initialization process and should not be called by external code.

Returns
  If the initalization went well.

## ◆ prepareForRelease()

virtual void nkGraphics::Renderer::prepareForRelease | ( |  | ) |
| pure virtual

Prepares the renderer for shutdown. This is taken care of by the component initialization process and should not be called by external code.

## ◆ shutdown()

virtual bool nkGraphics::Renderer::shutdown | ( |  | ) |
| pure virtual

Shuts down the renderer and frees all related memory. This is taken care of by the component initialization process and should not be called by external code.

Returns
  If the shutdown went well.

## ◆ flushRendering()

virtual void nkGraphics::Renderer::flushRendering | ( |  | ) |
| pure virtual

Flushes the rendering pipeline. This ensures that :

- The engine finishes all pending work
- The GPU finishes all work that has been submitted

This can be used to ensure a resource will be available next frame, for instance, as they can be loaded in async.

## ◆ preRenderRoutine()

virtual void nkGraphics::Renderer::preRenderRoutine | ( |  | ) |
| pure virtual

A pre render step, part of the rendering process. In theory, should never be called by external code.

## ◆ postRenderRoutine()

virtual void nkGraphics::Renderer::postRenderRoutine | ( |  | ) |
| pure virtual

A post render step, part of the rendering process. In theory, should never be called by external code.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsGraphics/Renderers/Renderer.h